﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

public partial class area_admin_teste : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {

        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["dbSisInfoConnectionString"].ToString());

        SqlCommand cmd = new SqlCommand(TextBox1.Text, con);

        con.Open();
        cmd.ExecuteNonQuery();

        con.Close();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();

        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["dbSisInfoConnectionString"].ToString());

        SqlCommand cmd = new SqlCommand(TextBox1.Text, con);

        SqlDataAdapter da = new SqlDataAdapter(cmd);

        con.Open();

        da.Fill(dt);

        con.Close();

        GridView1.DataSource = dt;

        GridView1.DataBind();
    }
}
